<?php
namespace PsiFramework\Classes\Util\Database\Query;

import("Classes.Util.Database.Query.SqlParameter");

use \PsiFramework\Classes\Util\Database\Query\SqlColumn;
use \PsiFramework\Classes\Util\Database\Query\SqlParameter;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The SqlIndex class allows to represent a sql index
 *
 * @package classes.util.xpersist.sql
 */
class SqlIndex extends SqlParameter
{

    protected /*string*/       $_name ;
    protected /*SqlColumn[]*/  $_columns ;

    /**
     * SqlIndex constructor
     *
     * @param $columns    the columns
     * @param $name        the name of the index
     */
    public function __construct(
        /*SqlColumn[]*/ $columns=null,
        /*string*/ $name=null
    )
    {
        $this->_columns = $columns ;
        $this->_name = $name ;
    }

    public function setName(/*string*/ $name)
    {
        $this->_name = $name ;
    }

    public function setColumns(/*SqlColumn[]*/ $columns)
    {
        $this->_columns = $columns ;
    }

    public function addColumn(SqlColumn $table)
    {
        $this->_columns[0] = $table ;
    }

    public function getName()
    {
        return $this->_name ;
    }

    public function getColumns()
    {
        return $this->_columns ;
    }

    public function getColumn()
    {
        return $this->_columns[0] ;
    }

}

